home *** CD-ROM | disk | FTP | other *** search
- Path: rzstud1.rz.uni-karlsruhe.de!uhay
- From: uhay@rzstud1.rz.uni-karlsruhe.de (David Luebbren)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Q: Output from Workbench program.
- Date: 14 Mar 1996 14:40:08 GMT
- Organization: University of Karlsruhe, Germany
- Message-ID: <4i9b48$8n7@nz12.rz.uni-karlsruhe.de>
- NNTP-Posting-Host: rzstud1.rz.uni-karlsruhe.de
- Mime-Version: 1.0
- Content-Type: text/plain; charset=iso-8859-1
- Content-Transfer-Encoding: 8bit
- NNTP-Posting-User: uhay
- X-Newsreader: TIN [version 1.2 PL2]
-
-
- I want to do output from a workbench started program similar to the way it
- is done with STDOUT and STDERR in SAS/C but using the amiga file handles.
- From several examples I gathered the following code but it doesn't work.
- What is wrong with it?
-
-
-
- struct WBStartup *WBenchMsg;
-
- int
- main (int ac, char **av)
- {
- struct Process *us;
- long fh;
-
- us = (struct Process *) FindTask (NULL);
- if (!us->pr_CLI) {
- WaitPort (&us->pr_MsgPort);
- WBenchMsg = (struct WBStartup *) GetMsg (&us->pr_MsgPort);
-
- fh = Open ("CON:10/10/300/50/Output", MODE_NEWFILE);
- if (fh) {
- struct FileHandle *handle = (struct FileHandle *) (fh << 2);
- us->pr_ConsoleTask = (APTR) handle->fh_Type;
- us->pr_CIS = fh;
- us->pr_COS = Open ("*", MODE_OLDFILE);
- PutStr ("Hello, world!\n");
- }
- Forbid ();
- ReplyMsg ((struct Message *) WBenchMsg);
- }
- }
-
-
-
- Thanks for any help.
-